﻿<?xml version="1.0" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
	namespace="DataAccess" assembly="DataAccess">

  <class name="DataAccess.User, DataAccess" table="[USER]">
    <id name="Id" column="ID" type="Int64">
		<generator class="identity"/>
    </id>
    <property name="Login" type="String" column="LOGIN"/>
    <property name="Password" type="String" column="PASSWORD"/>
	<property name="Name" type="String" column="NAME"/>
	<property name="Surname" type="String" column="SURNAME"/>
	<property name="MiddleName" type="String" column="MIDDLE_NAME"/>
	<property name="Email" type="String" column="EMAIL"/>
	<property name="Telephon" type="String" column="TEL_NUMBER"/>
	<property name="Info" type="String" column="INFORMATION"/>
	<many-to-one name="Role" column="ROLE_ID" 
		class="DataAccess.Role, DataAccess" />
	<set name="Educations" table="USER2EDUCATION" 
			cascade="all" inverse='true'
			access='NHibernate.Generics.GenericAccessor, NHibernate.Generics'>
		<key column="USER_ID" /> 
		<one-to-many class="DataAccess.Education, DataAccess" /> 
	</set>
	<set name="UserEvents" table="EVENT2USER"  
			cascade="all" inverse='true'
			access='NHibernate.Generics.GenericAccessor, NHibernate.Generics'>
		<key column="USER_ID" /> 
		<one-to-many class="DataAccess.UserEvent, DataAccess" /> 
	</set>
	<list name="Groups" table="GROUP2USER">
		<key column="USER_ID" />
		<index column="ID" />
		<many-to-many
			column="GROUP_ID"
			class="DataAccess.EducationGroup, DataAccess"
			outer-join="true" />
    </list>
  </class>
</hibernate-mapping>

